import cgi
import os

from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp.util import run_wsgi_app

class Greeting(db.Model):
	author = db.UserProperty()
	content = db.StringProperty(multiline=True)
	date = db.DateTimeProperty(auto_now_add=True)

class Tree(db.Model):
	text = db.StringProperty()
	action = db.StringProperty()
	cls = db.StringProperty()
	leaf = db.StringProperty()
	model = db.StringProperty()
	pid = db.StringProperty()
	uid = db.IntegerProperty()
	author = db.UserProperty()


class Rss(db.Model):
	title = db.StringProperty()
	url = db.StringProperty()
	createdate = db.DateTimeProperty(auto_now_add=True)
	tree=db.ReferenceProperty(Tree,collection_name='trees')
	
class UserData(db.Model):
	title = db.StringProperty()
	url = db.StringProperty()
	content = db.TextProperty()
	createdate = db.DateTimeProperty(auto_now_add=True)
	updatedate = db.DateTimeProperty(auto_now=True)
	clickcount = db.IntegerProperty()
	recount = db.IntegerProperty()
	ip = db.StringProperty()
	userid = db.IntegerProperty()
	typeid = db.StringProperty()
	doctype = db.StringProperty()
	tree1=db.ReferenceProperty(Tree,collection_name='tree1')
	
class User(db.Model):
	name = db.StringProperty()
	name2 = db.StringProperty()
	pwd = db.StringProperty()
	mail = db.StringProperty()
	sex = db.IntegerProperty()
	skin = db.StringProperty()
	skin2 = db.StringProperty()
	logimg = db.StringProperty()

class Message(db.Model):
	content = db.StringProperty()
	createdate = db.DateTimeProperty(auto_now_add=True)
	userid = db.IntegerProperty()
	ip = db.StringProperty()
	